package com.itmayiedu.JDBCutil.MyJDBC.Jdbcimpl;

import com.itmayiedu.JDBCutil.MyJDBC.Jdbcs;
import com.itmayiedu.annotation.ExtInsert;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;

public class Insect implements Jdbcs {
    private Object[] args;
    private Method method;
    private AtomicInteger i;

    public Insect(Method method, Object[] args,AtomicInteger i) {
        this.i=i;
        this.args=args;
        this.method=method;
    }

    /**
     * 拿到sql和parameter的参数集
     * 调用JDBC底层原理 实现数据库的操作
     * @param annotation
     * @return
     */
    @Override
    public Object Jdbcs(Annotation annotation){
        ExtInsert extInsert=(ExtInsert)annotation;
        String sql=extInsert.value();
        Myparameters myparameters=new Myparameters(method,args);
        ConcurrentHashMap<Object, Object> map = myparameters.getObjectObjectConcurrentHashMap();
        System.out.println(map);
        return null;
    }
}
